//Documentation complete
/**
 * @author Jason
 * @version 2009AP06
 */

package broker;

import problemDomain.Bean;
import problemDomain.ErrorBean;

import java.util.List;

/**
 * An interface that defines a database broker which handles a certain bean.
 * @param <E> the type of <code>Bean</code> the broker handles 
 */
public abstract class Broker<E extends Bean> extends ReportBroker {
	
	/* Constructors */
	
	protected Broker () throws ErrorBean {
		super();
	}
	
	/* END Constructors */
	
	
	/* Abstract Methods */
	
	/**
	 * Persists a <code>Bean</code> to the database.
	 * @param o the <code>Bean</code> to persist
	 * @return <code>true</code> if the data has been persisted
	 * @throws ErrorBean when there is an error persisting data
	 */
	public abstract boolean persist (E o) throws ErrorBean;
	
	/**
	 * Removes a <code>Bean</code> from the database.
	 * @param o the <code>Bean</code> to remove
	 * @return <code>true</code> if the data has been deleted
	 * @throws ErrorBean when there is an error deleting data
	 */
	public abstract boolean remove (E o) throws ErrorBean;
	
	/**
	 * Searches for </code>Beans</code> which match the search criteria.
	 * @param o the <code>Bean</code> which is a search prototype 
	 * @return a <code>List</code> of results
	 * @throws ErrorBean when there is an error retrieving data
	 */
	public abstract List<E> search (E o) throws ErrorBean;
	
	/**
	 * Lists all </code>Beans</code>.
	 * @return a <code>List</code> of results
	 * @throws ErrorBean when there is an error retrieving data
	 */
	public abstract List<E> listAll () throws ErrorBean;
	
	/* END Abstract Methods */
	
}
